package me.sealer.algorithm.tree;

import java.util.Date;

/**
 * @author sealer
 * @date 2017/12/26.
 */
public class Person implements Comparable<Person> {
    private long id;
    private String name;
    private String sex;
    private Date birthday;

    public Person() {
    }

    public Person(long id, String name, String sex, Date birthday) {
        this.id = id;
        this.name = name;
        this.sex = sex;
        this.birthday = birthday;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Override
    public int compareTo(Person person) {
        int ret;
        if (this.birthday.before(person.birthday)) {
            ret = 1;
        } else if (this.birthday.after(person.birthday)) {
            ret = -1;
        } else {
            ret = 0;
        }

        return ret;
    }

    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                '}';
    }
}
